home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue29 / gmslabel / GMSLABEL.ZIP / LBLEDIT.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1997-11-23  |  2.6 KB  |  84 lines

  1. { GMSStickyLabel v1 by Glenn Shukster
  2.  
  3.    GMS COMPUTING INC.                   Phone         (905)771-6458
  4.    53 COLVIN CRES.                      Fax                   -6819
  5.    THORNHILL, ONT.                      Compuserve:       72734,123
  6.    CANADA  L4J 2N7                      InternetId:Gms@Shaw.wave.ca
  7.                               http://members.tor.shaw.wave.ca/~gms/
  8.  
  9.  This file is the Component Editor for TGMSStickyLabel.
  10.  See header of TGMSStickyLabel for more details.
  11. }
  12.  
  13. unit LblEdit;
  14.  
  15. interface
  16.  
  17. uses
  18.   {SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
  19.   Forms, Dialogs, StdCtrls, ExtCtrls, Spin, Buttons, DsgnIntf;}
  20.    DsgnIntf, GMSLabel, Dialogs, sysutils, Forms;
  21.  
  22. type
  23.   TGMSStickyLabelEditor = class( TComponentEditor )
  24.     function GetVerbCount : Integer; override;
  25.     function GetVerb( Index : Integer ) : string; override;
  26.     procedure ExecuteVerb( Index : Integer ); override;
  27.   end;
  28.  
  29. procedure Register;
  30.  
  31. implementation
  32.  
  33. function TGMSStickyLabelEditor.GetVerbCount : Integer;
  34. begin
  35.   Result := 7;
  36. end;
  37.  
  38. function TGMSStickyLabelEditor.GetVerb( Index : Integer ) : string;
  39. begin
  40.    Case Index Of
  41.     0 : Result := 'Align GMSStickyLabels';
  42.     1 : Result := 'Edit Caption';
  43.     2 : Result := 'Set Gap';
  44.     3 : Result := 'Left Align';
  45.     4 : Result := 'Right Align';
  46.     5 : Result := 'Top Align';
  47.     6 : Result := 'Bottom Align';
  48.    end;
  49. end;
  50.  
  51. procedure TGMSStickyLabelEditor.ExecuteVerb( Index : Integer );
  52. var
  53.   sGap: String;
  54.   ii : Integer;
  55. begin
  56.   Case Index Of
  57.     0 :
  58.       With TGMSStickyLabel(Component).Owner Do
  59.         For ii := 0 to ComponentCount-1 Do
  60.            If Components[ii] is TGMSStickyLabel Then
  61.               TGMSStickyLabel(Components[ii])._ReAlign;
  62.     1 :  TGMSStickyLabel(Component).Caption :=
  63.          InputBox('StickyLabel Caption','Enter Caption',TGMSStickyLabel(Component).Caption);
  64.     2 :
  65.        begin
  66.          { In Delphi 1 this line was too long so it was split}
  67.          sGap := IntToStr(TGMSStickyLabel(Component)._Gap);
  68.          TGMSStickyLabel(Component)._Gap := StrToInt(InputBox('StickyLabel Gap','Enter Label Gap#',sGap));
  69.        end;
  70.     3 :  TGMSStickyLabel(Component)._AlignTo := TAlignTo(alLeft);  { In Delphi 1 & 3 alLeft alone works}
  71.     4 :  TGMSStickyLabel(Component)._AlignTo := TAlignTo(alRight);
  72.     5 :  TGMSStickyLabel(Component)._AlignTo := TAlignTo(alTop);
  73.     6 :  TGMSStickyLabel(Component)._AlignTo := TAlignTo(alBottom);
  74.   end;
  75. end;
  76.  
  77. procedure Register;
  78. begin
  79.   RegisterComponentEditor( TGMSStickyLabel, TGMSStickyLabelEditor );
  80. end;
  81.  
  82.  
  83. end.
  84.